﻿<UserControl x:Class="StockholmsStad.Windows.UI.Modules.WatchList.Views.WatchListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:StockholmsStad.Windows.UI.Infrastructure.Converters;assembly=StockholmsStad.Windows.UI.Infrastructure">
    <UserControl.Resources>
        <converters:DateTimeToDateString x:Key="dateTimeString" />
        <converters:NullableIntToNAStringConverter x:Key="nullableIntConverter" />
        <converters:BoolToOppositeBoolConverter x:Key="boolConverter" />
    </UserControl.Resources>

    <Grid Margin="10,10,10,10">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>

        <GroupBox Header="Notiser" Grid.Row="0" Padding="5,5,5,5" HorizontalContentAlignment="Left" VerticalContentAlignment="Top">

            <ListView x:Name="listViewCeremonies" ItemsSource="{Binding}" Margin="5,5,5,5" 
                      ItemContainerStyle="{DynamicResource ListViewItemStyleNoInteractionVerticalTop}"
                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                      ScrollViewer.VerticalScrollBarVisibility="Auto">
                <ListView.View>
                    <GridView ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle1}" AllowsColumnReorder="False">
                        <GridView.Columns>
                            <GridViewColumn Header="Datum">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Date, Converter={StaticResource dateTimeString}}" VerticalAlignment="Top" HorizontalAlignment="Left" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Ärende-id">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding TicketId, Converter={StaticResource nullableIntConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Modifierad av">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding ModifiedByUser}" VerticalAlignment="Top" HorizontalAlignment="Left" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Information">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Information}" VerticalAlignment="Top" HorizontalAlignment="Left" 
                                                       Height="Auto" Width="300" TextWrapping="Wrap" />
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox Content="Noterat" Padding="5,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
                                                  IsChecked="False" Command="{Binding NoticeCommand}" 
                                                  IsEnabled="{Binding ReadOnly, Converter={StaticResource boolConverter}}" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>

        </GroupBox>

    </Grid>

</UserControl>
